home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <assert.h>
- #include "conio.h"
- #include "bios.h"
- #include "edt.h"
- #define true (!false)
- #define false 0
- int fner(char *s);
- int scr_refresh(void);
- int scr_getch(void);
- char *function_bar()
- {
- return "F1-Help F2-Save F3-Load F4-Saveas F5-Errs F9-Graph F10-Drawit ^Z Quit";
- }
-
-
- struct keymatch {int m; int val;};
- /* commands using hi 8 bits of bios, e.g. arrow keys */
- struct keymatch kmatch1[] = {
- 0x0e, edelete,
- 0x4d, eright,
- 0x4b, eleft,
- 0x48, eup,
- 0x53, edelright,
- 0x50, edown,
- 0x4a, edelline,
- 0x3b, ehelp,
- 0x3c, esave,
- 0x3d, eload,
- 0x3e, esaveas,
- 0x3f, eshowerror,
- 0x43, egraphmenu,
- 0x44, edrawit,
- 0x49, epageup,
- 0x51, epagedown,
- 0x47, ebol,
- 0x4f, eeol,
- 0,0
- };
- /* Normal key and ^ commands commands */
- struct keymatch kmatch2[] = {
- 13, ereturn,
- 3, equit,
- 4, eword,
- 5, eshowerror,
- 8, ehelp,
- 19, eshell,
- 20, etrace,
- 12, efindnext,
- 21, eundelline,
- 25, edelline,
- 26, eescape,
- 27, eescape,
- 0,0
- };
- /* Control K commands */
- struct keymatch kmatch3[] = {
- 'b', eselect,
- 'v', emove,
- 'k', emark,
- 'c', ecopy,
- 'y', ecut,
- 'u', epaste,
- 'p', epaste,
- 'r', eblockread,
- 'w', eblockwrite,
- 'm', egraphmenu,
- 'l', eload,
- 'd', edrawit,
- 's', esave,
- 'x', equit,
- 0,0
- };
- /* Control Q commands */
- struct keymatch kmatch4[] = {
- 'f', esearch,
- 'c', eendoffile,
- 'r', etopoffile,
- 0,0
- };
-
- text_inkey()
- {
- int cc,i,c1,c2,ff;
- scr_refresh();
- loop1: cc = bioskey(0);
- ff = bioskey(2);
- c1 = (cc & 0xff00)>>8;
- c2 = (cc & 0xff);
- if (c1==45 && ((ff & 8)>0) ) return eexitnow;
- for (i=0;kmatch1[i].m!=0;i++)
- if (kmatch1[i].m==c1) return kmatch1[i].val;
-
- switch(c2) {
- default:
- for (i=0;kmatch2[i].m!=0;i++)
- if (kmatch2[i].m==c2) return kmatch2[i].val;
- break;
- case 17:
- fner("^Q F=Find string, R=Top of file, C=End of file");
- cc = bioskey(0);
- c2 = (cc & 0xff);
- if (c2<32) c2 = c2 + 'a' - 1;
- c2 = tolower(c2);
- for (i=0;kmatch4[i].m!=0;i++)
- if (kmatch4[i].m==c2) return kmatch4[i].val;
- fner("Unrecognized Quick movement command");
- goto loop1;
- case 11:
- fner("^K B=begin block, P=Paste, Y=Cut, K=End block");
- cc = bioskey(0);
- c2 = (cc & 0xff);
- if (c2<32) c2 = c2 + 'a' - 1;
- c2 = tolower(c2);
- for (i=0;kmatch3[i].m!=0;i++)
- if (kmatch3[i].m==c2) return kmatch3[i].val;
- fner("Unrecognized block command");
- goto loop1;
- }
- return c2;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-